package com.starsoft.frame.base.web;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.starsoft.frame.base.service.HibernateService;
import com.starsoft.frame.core.web.WebUtil;


@RestController
@RequestMapping(value = "/base/hibernate")
public class HibernateController {

	@Autowired
	HibernateService ms=null;
	
	@RequestMapping(value = "buffer")
	public Map<String, Object> buffer(HttpServletRequest request) {
		try {
			ms.hibernateBuffer();
			return WebUtil.sucesseModel("清空缓存");
		} catch (Exception e) {
			return WebUtil.sucesseModel("清空缓存失败");
		}
	}
	
	@RequestMapping(value = "reloadConfig")
	public Map<String, Object> reloadConfig() {
		try {
			ms.reloadConfig();
		} catch (Exception e) {
			// TODO: handle exception
		}
		return WebUtil.sucesseModel("加载成功");
	}
	
}
